#!/usr/bin/python
import web
import json
from lib import MC
from config import *
mc = MC(userInfoDB)
class friend:
    def GET(self):
        if(chkuser(web.mc)):
            return getFriendList()
        else:
            return "<script>setTimeout(function(){return window.location.href='./';},2000);</script>please login"

class friend_add:
    def POST(self):
        if(chkuser(web,mc)):
            enter_user = web.input().add_user.encode('UTF-8');
            if enter_user is '':
                return "plase enter friend user name"
            else:
                return "wait friend confirm"
        else:
            return "plase login"

class friend_del:
    def POST(self):
        if(chkuser(web,mc)):
            enter_user = web.input().del_user.encode('UTF-8');
            if enter_user is '':
                return "plase enter user name"
            else:
                return "succss"
        else:
            return "plase login"

class friend_update:
    def POST(self):
        if(chkuser(web,mc)):
            i = web.input();
            enter_user_tag = i.tag.encode('UTF-8')
            if enter_user_tag is '':
                return "plase enter user tag"
            else:
                return "succss"
        else:
            return "plase login"
